/*
 *  Copyright (c) 2010-2023
 */
package net.siufung.market.base.app.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import net.siufung.market.base.app.mapper.IAppMenuMapper;
import net.siufung.market.base.app.mapper.entity.AppMenu;
import net.siufung.market.base.app.service.IAppMenuService;
import net.siufung.mybatis.base.BaseServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Collection;

/**
 * 系统应用菜单表 数据服务实现
 * @author 陈建峰
 * @since 2023-07-16 17:45:10
 * @version 1.0.0
 */
@Slf4j
@AllArgsConstructor
@Service("sysAppMenuService")
@Transactional(rollbackFor = Exception.class)
public class AppMenuServiceImpl extends BaseServiceImpl<IAppMenuMapper, AppMenu> implements IAppMenuService {

    @Override
    public boolean saveBatch(Integer appId, Collection<AppMenu> entityList) {
        super.remove(
                new LambdaQueryWrapper<AppMenu>().eq(AppMenu::getAppId, appId));
        return super.saveBatch(entityList);
    }
}